test(board): explain the namespace-package trap when the assertion fires - #523
Merged
Conversation
test_the_retired_backend_is_actually_gone failed in a working checkout while passing in CI, and the reason is worth writing down rather than just clearing. git removes tracked files, not directories that still hold an untracked __pycache__. So after #521, src/operations_center/adapters/plane/ survived as an EMPTY directory — and an empty directory is a PEP 420 namespace package. `import operations_center.adapters.plane` still succeeded, returning a module whose __file__ is None. Any `except ImportError:` fallback would have taken the wrong branch without saying so. CI never reproduces this (fresh checkout, nothing left behind). Anyone who pulls the deletion with a populated __pycache__ does. The assertion now says what happened, why an empty directory is not harmless, and prints the exact rmdir that fixes it. No behaviour change — the test already caught the condition; it just could not explain it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_the_retired_backend_is_actually_gonefailed in a working checkout while passing in CI. Not a flake — and the reason is worth writing down rather than just clearing.What happened
git removes tracked files, not directories that still hold an untracked
__pycache__. So after #521,src/operations_center/adapters/plane/survived as an empty directory.An empty directory is a PEP 420 namespace package:
The import succeeds. Any
except ImportError:fallback would have taken the wrong branch without saying so — which is precisely the class of silent-wrong-answer this seam's tests exist to prevent.Why CI can't see it
Fresh checkout, nothing left behind. Anyone who pulls the deletion with a populated
__pycache__reproduces it immediately. That asymmetry is why the message matters more than the assertion.The change
The assertion now says what happened, why an empty directory isn't harmless, and prints the exact
rmdirthat fixes it. Verified both ways — it fires with that message when the directory exists, and the file is 14 passed on a clean tree.No behaviour change: the test already caught the condition, it just couldn't explain it.
🤖 Generated with Claude Code